package cn.jtcoding.order.service.impl.feign.fallback;

import cn.jtcoding.common.framework.pagehelper.PagedGridResult;
import cn.jtcoding.common.framework.vo.ApiResult;
import cn.jtcoding.item.pojo.dataobject.ItemsDO;
import cn.jtcoding.item.pojo.dataobject.ItemsSpecDO;
import cn.jtcoding.item.pojo.vo.ItemCommentLevelCountVO;
import cn.jtcoding.item.pojo.vo.ItemCommentVO;
import cn.jtcoding.item.pojo.vo.ItemInfoVO;
import cn.jtcoding.item.pojo.vo.ItemSearchVO;
import cn.jtcoding.order.service.impl.feign.ItemFeignService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class ItemFeignFallbackFactory implements FallbackFactory<ItemFeignService> {

    @Override
    public ItemFeignService create(Throwable cause) {
        return new ItemFeignService() {
            @Override
            public ApiResult<ItemInfoVO> getItemInfo(String itemId) {
                return ApiResult.success();
            }

            @Override
            public ApiResult<ItemCommentLevelCountVO> getItemCommentCount(String itemId) {
                return ApiResult.success();
            }

            @Override
            public ApiResult<PagedGridResult<ItemCommentVO>> getItemComments(String itemId, Integer level, Integer page, Integer pageSize) {
                return ApiResult.success();
            }

            @Override
            public ApiResult<PagedGridResult<ItemSearchVO>> searchItems(String keywords, String sort, Integer page, Integer pageSize) {
                return ApiResult.success();
            }

            @Override
            public ApiResult<ItemsSpecDO> queryItemSpecById(String itemSpecId) {
                return ApiResult.success();
            }

            @Override
            public ApiResult<ItemsDO> queryItemById(String itemId) {
                return ApiResult.success();
            }

            @Override
            public ApiResult<String> queryItemMainImgById(String itemId) {
                return ApiResult.success();
            }

            @Override
            public void decreaseItemSpecStock(String itemSpecId, Integer buyCounts) {

            }
        };
    }
}
